package fhv.at.imageprocessing.dilateImage;

import java.beans.EventSetDescriptor;
import java.beans.MethodDescriptor;
import java.beans.ParameterDescriptor;
import java.beans.PropertyDescriptor;
import java.beans.SimpleBeanInfo;
import java.lang.reflect.Method;

import fhv.at.imageprocessing.ImageChangedEvent;
import fhv.at.imageprocessing.ImageChangedListener;
import fhv.at.imageprocessing.editors.ErodeKernelEditor;

public class DilateImageBeanInfo extends SimpleBeanInfo {

	@Override
	public PropertyDescriptor[] getPropertyDescriptors() {
		try {
			PropertyDescriptor kernel;
			Class cls = DilateImage.class;
			kernel = new PropertyDescriptor("kernel", cls);
			kernel.setPropertyEditorClass(ErodeKernelEditor.class);
			PropertyDescriptor pds[] = { kernel };
			return pds;
		} catch (Exception ex) {
			ex.printStackTrace();
		}
		return null;
	}

	@Override
	public EventSetDescriptor[] getEventSetDescriptors() {
		try {
			EventSetDescriptor esd1;
			Class c = DilateImage.class;
			String es = "imageChanged";
			Class lc = ImageChangedListener.class;
			String names[] = { "imageValueChanged" };
			String al = "addImageChangedListener";
			String rl = "removeImageChangedListener";
			esd1 = new EventSetDescriptor(c, es, lc, names, al, rl);
			EventSetDescriptor esd[] = { esd1 };
			return esd;
		} catch (Exception ex) {
			ex.printStackTrace();
		}
		return null;
	}

	@Override
	public MethodDescriptor[] getMethodDescriptors() {
		try {
			Class c = DilateImage.class;
			Class parameterTypes[] = new Class[1];
			parameterTypes[0] = ImageChangedEvent.class;
			String name = "imageValueChanged";
			Method method1 = c.getMethod(name, parameterTypes);
			ParameterDescriptor pds[] = new ParameterDescriptor[1];
			pds[0] = new ParameterDescriptor();
			MethodDescriptor md1 = new MethodDescriptor(method1, pds);
			MethodDescriptor mds[] = { md1 };
			return mds;
		} catch (Exception ex) {
			ex.printStackTrace();
		}
		return null;
	}
}
